import request from '@/utils/request'

// 查询客户协议价管理列表
export function listAgreement(query) {
  return request({
    url: '/basicsystem/agreement/list',
    method: 'get',
    params: query
  })
}

// 查询客户协议价管理详细
export function getAgreement(id) {
  return request({
    url: '/basicsystem/agreement/' + id,
    method: 'get'
  })
}

// 新增客户协议价管理
export function addAgreement(data) {
  return request({
    url: '/basicsystem/agreement',
    method: 'post',
    data: data
  })
}

// 修改客户协议价管理
export function updateAgreement(data) {
  return request({
    url: '/basicsystem/agreement',
    method: 'put',
    data: data
  })
}

// 删除客户协议价管理
export function delAgreement(id) {
  return request({
    url: '/basicsystem/agreement/' + id,
    method: 'delete'
  })
}

// 修改状态
export function updateAgreementStatus(ids,status) {
  return request({
    url: '/basicsystem/agreement/doChangeStatus/' + status + '/' + ids,
    method: 'get'
  })
}


// 查询客户协议价下拉框，有效的协议
export function selectListAgreement(query) {
  return request({
    url: '/basicsystem/agreement/selectlist',
    method: 'get',
    params: query
  })
}

export function updateCustomerAgreement(data){
  return request({
    url: '/basicsystem/agreement/updateCustomerAgreement',
    method: 'put',
    data: data
  })
}
export function selectCustomerListByAgreementId(id){
  return request({
    url: '/basicsystem/agreement/selectCustomerListByAgreementId/' + id,
    method: 'get'
  })
}

export function doCustomer(data){
  return request({
    url: '/basicsystem/agreement/doCustomer',
    method: 'put',
    data:data
  })
}

export function getAgreementDetail(query){
  return request({
    url: '/basicsystem/agreement/detailList',
    method: 'get',
    params: query
  })
}
